<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <input type="hidden" name="row[rules]" value="" />
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('项目/方法')}:</label>
        <div class="col-xs-12 col-sm-8">
            <span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><small>{:__('Check all')}</small></label></span>
            <span class="text-muted"><input type="checkbox" name="" id="expandall" /> <label for="expandall"><small>{:__('Expand all')}</small></label></span>

            <div id="treeview"></div>
        </div>
        <select class="form-control selectpicker hide" name="row[pid]" tabindex="-98"><option value="1"></option></select>
    </div>
    <div class="form-group">
        <div id="tableprice"></div>
        <textarea id="tptext" class="hide table"></textarea>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed" onclick="clearData();">{:__('Reset')}</button>
            <button type="button" class="btn btn-success btn-embossed" onclick="copyUrl();">{:__('复制代码')}</button>
        </div>
    </div>
<script>
function copyUrl() {
  let url = document.querySelector('#tptext');
  url.select();
  document.execCommand('Copy');
  layer.msg("已复制。");
}
function clearData() {
  $("#treeview").jstree('uncheck_all');
  document.querySelector('[name="row[rules]"]').value = "";
  Form.api.bindevent("form[role=form]");
  //document.querySelector('#tableprice').removeChild();
  //document.querySelector('#tptext').text = "";
  layer.msg("已重置。");
}
</script>
</form>
